package dao;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

public class HibernateDAO {

	EntityManager em = null;
	
	public HibernateDAO(){
		EntityManagerFactory factory =
				Persistence.createEntityManagerFactory("lojavirtualDB");
		em = factory.createEntityManager();
	}
	
	public List select(String search){
		
		em.getTransaction().begin();
		List lista = em.createNamedQuery(search).getResultList();
		em.close();
		return lista;
	}
}
